package com.mf.actions;

import com.mf.mpos.pub.Controler;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

public class Actions  {
	
	static ActionsActivity activity = null;
	public static void Open( Activity baseactivity , String cpation ){
		Intent intent = new Intent(baseactivity, ActionsActivity.class);
		beginwait();
		baseactivity.startActivity(intent);		
		activity = (ActionsActivity) waitret();
		activity.setTitle(cpation);
	}
	public static void Close( ){
		activity.runOnUiThread( new Runnable() {

			@Override
			public void run() {
				// TODO Auto-generated method stub
				activity.finish();				
			}			
		});
	}

	
	
	static Object ret = null ;
	static void beginwait(){
		ret = null;
	}
	static Object waitret(){
		while( ret == null ){
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return ret;
	}
	
	public static  void SetResult(Object oret){
		ret = oret;
	}
	
	
	public static  void unblockmsg(final String title, final String msg)
	{	
		activity.runOnUiThread( new Runnable() {
			@Override
			public void run() {
				// TODO Auto-generated method stub
				TextFragment tx =  new TextFragment();
				
				Bundle b = new Bundle();
				b.putString("msg", msg);
				b.putString("title", title);
				tx.setArguments(b);
				
				activity.ShowFragment(tx);
			}
		});
	}
		

	
	
	
	
	
	
	

}
